From 5eb181281a23aeb1b6c2ae5849eecca2937774b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Sat, 6 Jun 2020 08:31:35 +0200 Subject: [PATCH] fishbowl: Remove visibility handling First, almost all widgets are either visible and mapped, or visible and unmapped because they are !child_visible. In both cases, we do care about the size. If they are indeed invisible, gtk_widget_measure() will take care of that by returning all 0. And gtk_widget_unparent() already queues a resize on the parent if necessary, so that is unneeded as well. --- demos/gtk-demo/gtkfishbowl.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/demos/gtk-demo/gtkfishbowl.c b/demos/gtk-demo/gtkfishbowl.c index 47356924b6..ff30f1d873 100644 --- a/demos/gtk-demo/gtkfishbowl.c +++ b/demos/gtk-demo/gtkfishbowl.c @@ -108,10 +108,6 @@ gtk_fishbowl_measure (GtkWidget *widget, { child = value; - if (!gtk_widget_get_visible (child->widget)) - continue; - - if (orientation == GTK_ORIENTATION_HORIZONTAL) { gtk_widget_measure (child->widget, orientation, -1, &child_min, &child_nat, NULL, NULL); @@ -148,9 +144,6 @@ gtk_fishbowl_size_allocate (GtkWidget *widget, { child = value; - if (!gtk_widget_get_visible (child->widget)) - continue; - gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL); child_allocation.x = round (child->x * (width - child_requisition.width)); child_allocation.y = round (child->y * (height - child_requisition.height)); @@ -197,17 +190,11 @@ gtk_fishbowl_remove (GtkFishbowl *fishbowl, GtkWidget *widget) { GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl); - GtkWidget *widget_bowl = GTK_WIDGET (fishbowl); if (g_hash_table_remove (priv->children, widget)) { - gboolean was_visible = gtk_widget_get_visible (widget); - gtk_widget_unparent (widget); - if (was_visible && gtk_widget_get_visible (widget_bowl)) - gtk_widget_queue_resize (widget_bowl); - priv->count--; g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_COUNT]); } -- 2.30.2